#include <cstdlib>
#include <string>
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

class Solution {
public:
	char toLower(char c){
		if (c >= 'A' && c <= 'Z')
			return c - 'A' + 'a';
		else return c;
	}
	char isAlphaNumeric(char c){
		return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9');
	}
	bool isPalindrome(string s) {
		string ss;
		for (char c : s){
			if (isAlphaNumeric(c))
				ss.push_back(toLower(c));
		}
		bool isSuccess = true;
		for (int i = 0; i < ss.length() / 2; ++i){
			if (ss[i] != ss[ss.length() - i - 1]){
				isSuccess = false;
				break;
			}
		}
		return isSuccess;
	}
};
int main(int argc, char** argv){
	string s = "1a1";
	cout << Solution().isPalindrome(s) << endl;
	return 0;
}